<?php

include_once("../controller/predio_controller_class.php");

$campus = $_POST['camp'];
$predio = $_POST['predio'];

if(empty($campus)){
    echo "<script>alert('Preencha o campus')</script>";
}elseif(empty($predio)){
    echo "<script>alert('Preencha o predio')</script>";
}else{
    
    $objPredio = new PredioController();
    
    if($objPredio->cadastrar($campus, $predio)){
        $listPredio = $objPredio->selecionarPrediosPorCampusJSON($campus);

        echo json_encode($listPredio);
    }
    
    
}

